package com.wayhome.config.project;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.ConfigurableEnvironment;

@SpringBootApplication
@EnableDiscoveryClient
public class ConfigApplication {

    public static void main(String[] args) {
        ConfigurableApplicationContext applicationContext = SpringApplication.run(ConfigApplication.class, args);
        ConfigurableEnvironment environment = applicationContext.getEnvironment();
        String version = environment.getProperty("conf.version");
        String message = environment.getProperty("conf.message");
        String username = environment.getProperty("conf.user.name");
        System.out.println("version:" + version + "; message:" + message + ";  username:" + username);
    }
}
